package top.longmarch.flow.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import top.longmarch.flow.entity.LiteflowChain;
import top.longmarch.flow.mapper.LiteflowChainMapper;
import top.longmarch.flow.service.ILiteflowChainService;
import top.longmarch.flow.utils.PageUtil;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author YuYue
 * @since 2024-04-08
 */
@Service
public class LiteflowChainServiceImpl extends ServiceImpl<LiteflowChainMapper, LiteflowChain> implements ILiteflowChainService {
    @Override
    public IPage<LiteflowChain> search(Map<String, Object> params) {
        IPage<LiteflowChain> page = PageUtil.get(params);
        LambdaQueryWrapper<LiteflowChain> wrapper = new LambdaQueryWrapper<>();
        // 模糊查询
        // QueryHelper.addFuzzyQuery(wrapper, params, Constant.FUZZY_VALUE, functionList);
        return this.page(page, wrapper);
    }

    @Override
    public List<LiteflowChain> getChainList() {
        LambdaQueryWrapper<LiteflowChain> wrapper = Wrappers.lambdaQuery();
        wrapper.select(LiteflowChain::getId, LiteflowChain::getChainName, LiteflowChain::getChainDesc);
        return this.list(wrapper);
    }

}
